//
//  MusicPlayerTableViewCell.m
//  ToWhere
//
//  Created by dllo on 15/11/23.
//  Copyright © 2015年 www.TE.com. All rights reserved.
//

#import "MusicPlayerTableViewCell.h"

@interface MusicPlayerTableViewCell()

@property(nonatomic, retain) UILabel *countLabel;

@property(nonatomic, retain) UILabel *titleLabel;

@property(nonatomic, retain) UILabel *singerName;

@property(nonatomic, retain) UIImageView *deleImage;

@end

@implementation MusicPlayerTableViewCell

- (void)dealloc
{
    [_musicDetailModel release];
    [_countLabel release];
    [_titleLabel release];
    [_singerName release];
    [_deleImage release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.countLabel = [[UILabel alloc]init];
        self.countLabel.textColor = [UIColor lightGrayColor];
        self.countLabel.font = [UIFont systemFontOfSize:17 * kWidth];
        [self.contentView addSubview:self.countLabel];
        [_countLabel release];
        
        self.titleLabel = [[UILabel alloc]init];
        self.titleLabel.font = [UIFont systemFontOfSize:15 * kWidth];
        self.titleLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:self.titleLabel];
        [_titleLabel release];
        
        self.singerName = [[UILabel alloc]init];
        self.singerName.textColor = [UIColor lightGrayColor];
        self.singerName.font = [UIFont systemFontOfSize:15 * kWidth];
        [self.contentView addSubview:self.singerName];
        [_singerName release];
        
//        self.deleImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"Music_playlist_dele"]];
//        [self.contentView addSubview:self.deleImage];
//        [_deleImage release];
        
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    self.countLabel.frame = CGRectMake(15 * kWidth, self.frame.size.height / 2 - 10 * kHeight, 30 * kWidth, 20 * kHeight);
    self.titleLabel.frame = CGRectMake(50 * kWidth, 10 * kHeight, self.frame.size.width - 70 * kWidth, 20 * kHeight);
    self.singerName.frame = CGRectMake(50 * kWidth, 35, 300 * kWidth, 20 * kHeight);
    self.deleImage.frame = CGRectMake(self.frame.size.width - 40 * kWidth, self.frame.size.height / 2 - 12.5 * kHeight, 25 * kWidth, 25 * kHeight);
}

-(void)setMusicDetailModel:(MusicDetailModel *)musicDetailModel
{
    if (_musicDetailModel != musicDetailModel) {
        [_musicDetailModel release];
        _musicDetailModel = [musicDetailModel retain];
    }
    self.titleLabel.text = musicDetailModel.name;
//    self.singerName.text = [musicDetailModel.User objectForKey:@"name"];
}

-(void)setRow:(NSInteger)row
{
    if (_row != row) {
        _row = row;
    }
    self.countLabel.text = [NSString stringWithFormat:@"%ld", row + 1];
}


@end
